This page last changed on Jul 24, 2007 by cholmes.

Introduction

The DB2 datastore is new with GeoTools 2.1 and GeoServer 1.3.

The IBM DB2 UDB database is a commercial relational database (RDBMS) implementing ISO SQL standards and is similar in functionality to Oracle, SQL Server, MySQL, PostGres and other RDBMS.

The DB2 Spatial Extender is a no-charge licensed feature of DB2 UDB which implements the OGC specification "Simple Features for SQL using types and functions" and the ISO "SQL/MM Part 3 Spatial" standard.

If you are interested in trying it out, a trial copy of DB2 UDB and Spatial Extender can be downloaded from:
http://www-306.ibm.com/software/data/db2/udb/edition-pde.html

Note also there is now an 'Express-C' version of DB2, that is free, comes with spatial support, and has no limits on size. We have not yet had a chance to test it against GeoServer, but are reasonably confident it should work. If you try it out please let us know. It can be found at: http://www-306.ibm.com/software/data/db2/express/download.html

Installation

These instructions assume that you have already installed a copy of DB2 UDB, the DB2 Spatial Extender and latest fixpacks.

You should have also created and spatially-enabled a database using the instructions in the "User's Guide and Reference" which can be found at:
ftp://ftp.software.ibm.com/software/data/spatial/db2sb.pdf

You need to copy the gt2-db2.jar file to the HOME/webapps/geoserver/WEB-INF/lib/ directory.

The DB2 JDBC driver also needs to be copied to the above directory. The DB2 JDBC driver consists of the files db2jcc.jar and
db2jcc_license_cu.jar from the DB2 instance installation directory $DB2PATH/java.

Configuration

After installing the the jar files you should restart GeoServer.

You should now be able to use the GeoServer Administration GUI to Create New DataStore and see 'DB2' listed in the drop-down list of
DataStore Descriptions.

Note that in general, DB2 schema, table and column names are all case-sensitive when working with GeoTools/GeoServer. When working with DB2 scripts and the DB2 command window, the default is to treat these names as upper-case unless enclosed in double-quote characters.

The params needed are as follows:

Param Name Description
host The machine which the DB2 instance is running on.
port The port DB2 is running on, generally 50000.
user The user to connect with
passwd The password of the user connecting
dbtype Must be 'db2' to use this datastore
schema The schema the tables belong to. Mandatory and case sensitive.

The following is an example of a DB2 datastore definition in the GeoServer catalog.xml file.

<datastore id="cdf" enabled="true" namespace="cdf">
      <description>A sample DB2 testing database</description>
      <connectionParams>
        <parameter name="dbtype" value="db2"/>
        <parameter name="host" value="localhost"/>
        <parameter name="port" value="50000"/>
        <parameter name="database" value="cite"/>
        <parameter name="user" value="db2admin"/>
        <parameter name="passwd" value="adminpw"/>
        <parameter name = "tabschema" value = "cdf"  />
      </connectionParams>
    </datastore>

Documentation

General information about DB2 UDB and DB2 Spatial Extender can be found at:
http://www.software.ibm.com/data/udb
http://www.software.ibm.com/data/spatial

"IBM DB2 UDB Spatial Extender User's Guide and Reference" which can be found at:
ftp://ftp.software.ibm.com/software/data/spatial/db2sb.pdf

Another good reference is the DB2 Information Center at:
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp

DB2 fixpacks and other support information can be found at:
http://www-306.ibm.com/software/data/db2/udb/support/

Support

Questions and problems can be reported to the [email protected]
mailing list. You need to be registered in order to send to this list.
You can also use the ibm.software.db2.udb.spatial newsgroup on
news.software.ibm.com.

Bugs

For any problems please make use of our JIRA task tracker at:
http://jira.codehaus.org/secure/BrowseProject.jspa?id=10311 or email
[email protected].

Chris, have you tested the Spatial Extender with DB2 Express-C (not Express Edition) ?

It's all confusing.

The overview of DB2 Express-C on the IBM website lists Spatial Extender in the extended features not included in the free DB2 Express-C and this post on DB2 Express forum confirms this information.

I downloaded free-of-charge version of the Spatial Extender (db2_v9_nt32_gse.zip file) and here is what I get when trying to install DB2 Spatial Extender.msi (screenshot):

http://mateusz.loskot.net/tmp/db2-se.png

I have DB2 Express-C V9 installed on my Windows XP Professional.

Althought, here is another interesting message that seems to explain this ambiguity.

As I found, it's not yet available to download.

Mateusz 

Posted by mloskot at Jun 23, 2007 22:33
Document generated by Confluence on Jan 16, 2008 23:27